<template>
    <require from="./em-project-edit-status.less"></require>
    <div class="em-project-edit-status">
        <div class="ui form">
            <div class="fields">
                <div class="six wide field">
                    <label>名称</label>
                    <input type="text" value.bind="name" placeholder="">
                </div>
                <div class="eight wide field">
                    <label>描述</label>
                    <input type="text" value.bind="desc" placeholder="">
                </div>
                <div class="two wide field">
                    <label style="visibility: hidden;">添加</label>
                    <div click.delegate="addHandler()" class="ui icon blue circular button" title="添加状态"><i class="plus icon"></i></div>
                </div>
            </div>
        </div>
        <div class="ui divider"></div>
        <table class="ui table">
            <thead>
                <tr>
                    <th>顺序</th>
                    <th>名称</th>
                    <th>描述</th>
                    <th class="right aligned">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr repeat.for="item of states | sort:'order'">
                    <td>${$index + 1}</td>
                    <td>
                        <em-editable-input value.bind="item.name" onok.call="editNameOkHandler($event, item)"></em-editable-input>
                    </td>
                    <td>
                        <em-editable-input value.bind="item.description" onok.call="editDescOkHandler($event, item)"></em-editable-input>
                    </td>
                    <td class="right aligned">
                        <div class="ui horizontal bulleted list">
                            <a if.bind="!$first" click.delegate="upHandler(item)" class="item">上移</a>
                            <a if.bind="!$last" click.delegate="downHandler(item)" class="item">下移</a>
                            <a style="color: red;" ui-dropdown-action class="ui icon top right pointing dropdown item" title="删除状态">
                                删除
                                <div class="menu">
                                    <div style="color: red;" class="item" click.delegate="delHandler(item)"><i class="trash red outline icon"></i>确认删除</div>
                                </div>
                            </a>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>
